const API = require('../../pages/api/index')
const { typeJson } = require('../../utils/typejson')
let prolist = wx.getStorageSync('prolist')==''?wx.getStorageSync('prolist'):JSON.parse(wx.getStorageSync('prolist'))


Page({

  /**
   * 页面的初始数据
   */
  data: {
    pulldown:"",
    pullup:2,
    addButton:"true",
    prolist:wx.getStorageSync('prolist')==''?wx.getStorageSync('prolist'):JSON.parse(wx.getStorageSync('prolist')),
    listConfig: [
      {
        label: "培训开始时间",
        prop: "createTime",
      
      },
      {
        label: "培训内容简介",
        prop: "content",
      },
      ],
    
 
      formConfig: [
        {
          label: "内容简介",
          prop: "content",
          required:true,
        },
        {
          label: "培训类型",
          prop: "type", 
          jsonType:typeJson.types,
          type: "dropDown",
          required:true,
        },
        {
          label: "培训开始时间",
          prop: "startTime",
          type:'dateTime',
          required:true,
        },
        {
          label: "培训结束时间",
          prop: "endTime",
          type:'dateTime',
          required:true,
        },
        {
          label: "主讲人",
          prop: "mainTalker",
          required:true,
        },
        {
          label: "培训单位",
          prop: "trainBranch",
          required:true,  
        },
       
        {
          label: "培训课时",
          prop: "period",
          type:"number",
          required:true,
        
        },
        {
          label: "计划参入人员",
          prop: "minerIds",
          type: 'multiDropDown',
          hidden:"look",
          required:true,
          net: {
            url: '/app/memberinfo/getList',
            method: 'post',
            key: 'memberId',
            data:{
              mineId: true,
            },
            value: 'nickName'
          }
        },
        {
          label: "计划参入人员",
          prop: "minerNames",
          hidden:"edit"
        },
        {
          label: '附件',
          prop: 'trainContentPath',
          type: 'image',
         
        },
        {
          label: '备注',
          prop: 'remark',
          
        }
       
        
       


     
       
      
        ],
    
        
        net: {
       
            select: {
              url: `/app/trainPlan/getList`,
              method: 'post',
              data: {
                mineId: true,
               
              }
            },
            delete: {
              url: '/app/trainPlan/delete',
              method: 'post',
              data: {
                
              }
            },
            insert: {
              url: '/app/trainPlan/edit',
              method: 'post',
              data: {
                mineId:true,
                createUserId:"userid"
               
              }
            },
            update: {
              url: '/app/trainPlan/edit',
              method: 'post',
              data: {
                mineId:true,
                createUserId:"userid"
              }
            }
  
          
        },
        showCom:true
      },

     
  

  /**
   * 生命周期函数--监听页面加载
   */


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
   
    this.setData({
      showCom: false
    });
    this.setData({
      showCom: true
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

/**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh()
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    this.setData({
      pullup: this.data.pullup + 1
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})